<?php require_once('Connections/staf.php'); ?>
<?php
//initialize the session
if (!isset($_SESSION)) {
  session_start();
}

// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
  $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
  //to fully log out a visitor we need to clear the session varialbles
  $_SESSION['MM_Username'] = NULL;
  $_SESSION['MM_UserGroup'] = NULL;
  $_SESSION['PrevUrl'] = NULL;
  unset($_SESSION['MM_Username']);
  unset($_SESSION['MM_UserGroup']);
  unset($_SESSION['PrevUrl']);
	
  $logoutGoTo = "login.php";
  if ($logoutGoTo) {
    header("Location: $logoutGoTo");
    exit;
  }
}
?>
<?php
if (!isset($_SESSION)) {
  session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { 
  // For security, start by assuming the visitor is NOT authorized. 
  $isValid = False; 

  // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
  // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
  if (!empty($UserName)) { 
    // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
    // Parse the strings into arrays. 
    $arrUsers = Explode(",", $strUsers); 
    $arrGroups = Explode(",", $strGroups); 
    if (in_array($UserName, $arrUsers)) { 
      $isValid = true; 
    } 
    // Or, you may restrict access to only certain users based on their username. 
    if (in_array($UserGroup, $arrGroups)) { 
      $isValid = true; 
    } 
    if (($strUsers == "") && true) { 
      $isValid = true; 
    } 
  } 
  return $isValid; 
}

$MM_restrictGoTo = "login.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
  $MM_qsChar = "?";
  $MM_referrer = $_SERVER['PHP_SELF'];
  if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
  if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0) 
  $MM_referrer .= "?" . $QUERY_STRING;
  $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
  header("Location: ". $MM_restrictGoTo); 
  exit;
}
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
  $updateSQL = sprintf("UPDATE permohonan_kursus SET nama=%s, noic=%s, kategori_kursus=%s, nama_kursus=%s, tempat_kursus=%s, anjuran=%s, tarikh_mula=%s, tarikh_tamat=%s, bil_hari=%s, tarikh_key_in=%s, disahkan=%s, kumpulan_perkhidmatan=%s WHERE id=%s",
                       GetSQLValueString($_POST['nama'], "text"),
                       GetSQLValueString($_POST['noic'], "text"),
                       GetSQLValueString($_POST['kategori_kursus'], "text"),
                       GetSQLValueString($_POST['nama_kursus'], "text"),
                       GetSQLValueString($_POST['tempat_kursus'], "text"),
                       GetSQLValueString($_POST['anjuran'], "text"),
                       GetSQLValueString(date('Y-m-d',strtotime($_POST['tarikh_mula'])), "date"),
                       GetSQLValueString(date('Y-m-d',strtotime($_POST['tarikh_tamat'])), "date"),
                       GetSQLValueString($_POST['bil_hari'], "int"),
                       GetSQLValueString(date('Y-m-d',strtotime($_POST['tarikh_key_in'])), "date"),
                       GetSQLValueString($_POST['disahkan'], "text"),
                       GetSQLValueString($_POST['kumpulan_perkhidmatan'], "text"),
                       GetSQLValueString($_POST['id'], "int"));

  mysql_select_db($database_staf, $staf);
  $Result1 = mysql_query($updateSQL, $staf) or die(mysql_error());

  $updateGoTo = "rekodkehadiran.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
    $updateGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $updateGoTo));
}

mysql_select_db($database_staf, $staf);
$id = $_GET['id'];
$query_rekodkahadiran = "SELECT * FROM permohonan_kursus where id = '$id'";
$rekodkahadiran = mysql_query($query_rekodkahadiran, $staf) or die(mysql_error());
$row_rekodkahadiran = mysql_fetch_assoc($rekodkahadiran);
$totalRows_rekodkahadiran = mysql_num_rows($rekodkahadiran);
$userid = $row_rekodkahadiran['stafid'];

mysql_select_db($database_staf, $staf);
$query_maklumatstaf = "SELECT * FROM maklumat_staf where id = '$userid'";
$maklumatstaf = mysql_query($query_maklumatstaf, $staf) or die(mysql_error());
$row_maklumatstaf = mysql_fetch_assoc($maklumatstaf);
$totalRows_maklumatstaf = mysql_num_rows($maklumatstaf);
?>
<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]>    <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]>    <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if IE 9]>    <html class="no-js ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<?php error_reporting(E_ERROR);?>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<title>E-Log Latihan Bahagian Sumber Manusia</title>
    
	<link rel="icon" type="image/png" href="favicon.png">
    	<!-- This is the traditional favicon.
		 - size: 16x16 or 32x32
		 - transparency is OK
		 - see wikipedia for info on browser support: http://mky.be/favicon/-->
		 
	<link rel="apple-touch-icon" href="apple-touch-icon-precomposed.png">
	<!-- The is the icon for iOS's Web Clip.
		 - size: 57x57 for older iPhones, 72x72 for iPads, 114x114 for iPhone4's retina display (IMHO, just go ahead and use the biggest one)
		 - To prevent iOS from applying its styles to the icon name it thusly: apple-touch-icon-precomposed.png
		 - Transparency is not recommended (iOS will put a black BG behind the icon) -->
         
	<meta name="description" content="">
	<meta name="author" content="Falcon Creative Studio - Shahul Hameed">
	
    <!-- Fonts -->
    <link rel="stylesheet" type="text/css" href="css/fonts.css">
    <link rel="stylesheet" type="text/css" href="css/font-awesome.css">
    
    <!-- Bootstrap -->
	<link href="css/bootstrap.css" rel="stylesheet" type="text/css" media="all">
    
    
    <link rel="stylesheet" type="text/css" href="css/style.css">
    <link rel="stylesheet" type="text/css" href="colors-css/default.css" class="colorCssStyles">
<link rel="stylesheet" type="text/css" href="css/responsive.css">
    <!--[if IE 8]>
	  <link rel="stylesheet" type="text/css" href="css/ie8.css">
	<![endif]-->    
    
    
    <script src="js/libs/modernizr-2.5.3.min.js"></script>
</head>
<body>
<p id="back-top"><a href="#top"><span class="icon-chevron-up"></span></a></p>
<!--[if lte IE 7]><p class=chromeframe>Your browser is <em>ancient!</em> <a href="http://browsehappy.com/">Upgrade to a different browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">install Google Chrome Frame</a> to experience this site.</p><![endif]-->

<!-- Top Header -->
<!--<div class="pageTopCon">
	<div class="pageTop row-fluid">
        <div class="span6"><p><span>E: info@yoursite.com</span>&emsp;<span>T: + (009) 123 4567</span></p></div>
        <div class="span6">
            <p class="pull-right socialIcons">
            	<a href="#" class="twitter" title="Twitter">Twitter</a>
                <a href="#" class="facebook" title="Facebook">Facebook</a>
                <a href="#" class="gplus" title="Gplus">G+</a>
                <a href="#" class="linkedin" title="linkedin">Linked In</a>
                <a href="#" class="dribble" title="Dribble">Dribble</a>
                <a href="#" class="flickr" title="Flickr">Flickr</a>
                <a href="#" class="vimeo" title="Vimeo">vimeo</a>
                <a href="#" class="rss" title="Rss">Rss</a>
            </p>
        </div>
    </div>
</div>-->

<!-- Page Header -->
<header id="pageHeader" class="clearfix">
    <div id="logo">
        <a href="index.html">E-Log Latihan</a>
    </div>
    <nav id="mainNav">
    	<ul class="menu">
        	<li class="mainMenu"><a href="index.php">Halaman <br>Utama</a><!--<span class="taline">start here</span>-->
                <!--<ul>
                  	<li class="arrow"></li>
                    <li><a href="index-2.html">Home Page 1</a></li>
                    <li><a href="home-page-2.html">Home Page 2</a></li>
                  	<li class="border"></li>
                </ul>-->
            </li>
            <li class="mainMenu ">
            	<a href="maklumatperibadi.php">Maklumat <br>Peribadi</a><!--<span class="taline">list of all pages</span>-->
            	<!--<ul>
                  <li class="arrow"></li>
                  <li><a href="about.html">About Us</a></li>
                  <li>
                  <a href="services.html">Services</a>
                  </li>
                  <li>
                  	<a href="portfolio-col-3.html">Portfolio  <span class="plus">+</span></a>
                  	<ul>
                    	<li class="arrow"></li>
                    	<li><a href="portfolio-col-2.html">Two Col Portfolio</a></li>
                        <li><a href="portfolio-col-3.html">Three Col Portfolio</a></li>
                        <li><a href="portfolio-col-4.html">Four Col Portfolio</a></li>
                        <li><a href="single-portfolio.html">Single Portfolio</a></li>
                        <li class="border"></li>
                    </ul>
                  </li>
                  <li>
                  	<a href="blog.html">Blog <span class="plus">+</span></a>
                    <ul>
                    	<li class="arrow"></li>
                    	<li><a href="blog.html">Blog</a></li>
                        <li><a href="single-post.html">Single Post</a></li>
                        <li class="border"></li>
                    </ul>
                  </li>
                  <li><a href="columns.html">Columns</a></li>
                  <li><a href="left-navigation.html">Left Navigation</a></li>
                  <li><a href="right-navigation.html">Right Navigation</a></li>
                  <li><a href="shortcodes.html">Shortcodes</a></li>
                  <li><a href="pricing-table.html">Pricing Table</a></li>
                  <li class="border"></li>
                </ul>-->
            </li>
            <li class="mainMenu active">
            	<a href="rekodkehadiran.php">Rekod <br>Kehadiran</a><!--<span class="taline">our featured works</span>-->
            	<!--<ul>
                    <li class="arrow"></li>
                    <li><a href="portfolio-col-2.html">Two Col Portfolio</a></li>
                    <li><a href="portfolio-col-3.html">Three Col Portfolio</a></li>
                    <li><a href="portfolio-col-4.html">Four Col Portfolio</a></li>
                    <li><a href="single-portfolio.html">Single Portfolio</a></li>
                    <li class="border"></li>
                </ul>-->
          </li>
            <li class="mainMenu"><a href="trainingroadmap.php">Training <br>Road Map</a><!--<span class="taline">latest news</span>--></li>
            <li class="mainMenu"><a href="<?php echo $logoutAction ?>">Logout</a><!--<span class="taline">Logout</span></li>--> 
       </ul>
    </nav>
</header>

<!-- Banner -->
<div id="bannerCon" class="sub clear">
	<div id="banner" class="row-fluid">
        <header class="bannerHeader span8">
            <h2>E-log <span class="orange">Latihan</span></h2>
        </header>
        <div class="span4">
        	<ul class="breadcrumb">
              <li><a href="index.php">Halaman Utama</a> <span class="divider"></span></li>
            </ul>
        </div>
  </div>   
</div>

<!-- Page Content -->
<div role="main" id="mainContent" class="center row-fluid servicesPage clearfix">
	
    <!-- Services List 
    <section>
        <p class="emphasis">Completely pursue collaborative methods of empowerment for interoperable outsourcing. Compellingly deploy cross-media results without market-driven methods of empowerment. Efficiently restore backend niche markets rather than e-business communities. Phosfluorescently restore business customer service rather than cross functional e-tailers. Conveniently leverage other's multifunctional vortals without customized systems.</p>
      
    </section>-->
    <section>
        <p class="emphasis">Completely pursue collaborative methods of empowerment for interoperable outsourcing. Compellingly deploy cross-media results without market-driven methods of empowerment. Efficiently restore backend niche markets rather than e-business communities. Phosfluorescently restore business customer service rather than cross functional e-tailers. Conveniently leverage other's multifunctional vortals without customized systems.</p>
      
    </section>
<section class="newSection noMarginBottom clearfix services">
        <h2 class="borderLine uppercase"><span class="bg">Drive’s Mostly Focus on</span></h2> 
        <div class="row-fluid">
            <div class="span3 alignCenter">
                <div class="singleService">
                    <div class="sepCenter">
                        <div class="outerCircle rotate1">
                            <p class="icon190"><span class="icon-edit"></span></p>
                        </div>
                    </div>
                </div>    
            </div>
            
          <div class="span9 animateIconServices">
            	<h3 class="serviceTitle">Rekod Kehadiran</h3>
       	    <p>&nbsp;</p>
            <form method="post" name="form1" action="<?php echo $editFormAction; ?>">
              <table width="100%" align="center">
                <tr valign="baseline">
                  <td width="185">NAMA</td>
                  <td><input type="text" name="nama" value="<?php echo htmlentities($row_maklumatstaf['nama']); ?>" size="32"></td>
                </tr>
                <tr valign="baseline">
                  <td>NO KAD PENGENALAN</td>
                  <td><input type="text" name="noic" value="<?php echo htmlentities($row_maklumatstaf['noic']); ?>" size="32"></td>
                </tr>
                <tr valign="baseline">
                  <td>KATEGORI KURSUS</td>
                  <td><input type="text" name="kategori_kursus" value="<?php echo htmlentities($row_rekodkahadiran['kategori_kursus'], ENT_COMPAT, ''); ?>" size="32"></td>
                </tr>
                <tr valign="baseline">
                  <td>NAMA KURSUS</td>
                  <td><input type="text" name="nama_kursus" value="<?php echo htmlentities($row_rekodkahadiran['nama_kursus'], ENT_COMPAT, ''); ?>" size="32"></td>
                </tr>
                <tr valign="baseline">
                  <td>TEMPAT KURSUS</td>
                  <td><input type="text" name="tempat_kursus" value="<?php echo htmlentities($row_rekodkahadiran['tempat_kursus'], ENT_COMPAT, ''); ?>" size="32"></td>
                </tr>
                <tr valign="baseline">
                  <td>ANJURAN</td>
                  <td><input type="text" name="anjuran" value="<?php echo htmlentities($row_rekodkahadiran['anjuran'], ENT_COMPAT, ''); ?>" size="32"></td>
                </tr>
                <tr valign="baseline">
                  <td>TARIKH MULA</td>
                  <td><input type="text" name="tarikh_mula" value="<?php echo htmlentities(date('m/d/Y',strtotime($row_rekodkahadiran['tarikh_mula'])), ENT_COMPAT, ''); ?>" size="32"></td>
                </tr>
                <tr valign="baseline">
                  <td>TARIKH TAMAT</td>
                  <td><input type="text" name="tarikh_tamat" value="<?php echo htmlentities(date('m/d/Y',strtotime($row_rekodkahadiran['tarikh_tamat'])), ENT_COMPAT, ''); ?>" size="32"></td>
                </tr>
                <tr valign="baseline">
                  <td>BIL HARI</td>
                  <td><input type="text" name="bil_hari" value="<?php echo htmlentities($row_rekodkahadiran['bil_hari'], ENT_COMPAT, ''); ?>" size="32"></td>
                </tr>
                <tr valign="baseline">
                  <td>TARIKH KEY IN</td>
                  <td><input type="text" name="tarikh_key_in" value="<?php echo htmlentities(date('m/d/Y',strtotime($row_rekodkahadiran['tarikh_key_in'])), ENT_COMPAT, ''); ?>" size="32"></td>
                </tr>
                <tr valign="baseline">
                  <td>DISAHKAN</td>
                  <td><input type="text" name="disahkan" value="<?php echo htmlentities($row_rekodkahadiran['disahkan'], ENT_COMPAT, ''); ?>" size="32"></td>
                </tr>
                <tr valign="baseline">
                  <td>KUMPULAN PERKHIDMATAN</td>
                  <td><input type="text" name="kumpulan_perkhidmatan" value="<?php echo htmlentities($row_rekodkahadiran['kumpulan_perkhidmatan'], ENT_COMPAT, ''); ?>" size="32"></td>
                </tr>
                <tr valign="baseline">
                  <td nowrap align="right">&nbsp;</td>
                  <td><input type="submit" value="Update record"></td>
                </tr>
              </table>
              <input type="hidden" name="id" value="<?php echo $row_rekodkahadiran['id']; ?>">
              <input type="hidden" name="MM_update" value="form1">
              <input type="hidden" name="id" value="<?php echo $row_rekodkahadiran['id']; ?>">
            </form>
            <p>&nbsp;</p>
</p>
       	    <p>&nbsp;</p>
          </div>
        </div>     
      	<!-- Seperate -->
     	<div class="sep double">&nbsp;</div>
        
  </section>
    <!--<section class="newSection noMarginBottom clearfix services">
        <h2 class="borderLine uppercase"><span class="bg">Drive’s Mostly Focus on</span></h2> 
        <div class="row-fluid">
            <div class="span3 alignCenter">
                <div class="singleService">
                    <div class="sepCenter">
                        <div class="outerCircle rotate1">
                            <p class="icon190"><span class="icon-beaker"></span></p>
                        </div>
                    </div>
                </div>    
            </div>
            
            <div class="span9 animateIconServices">
            	<h3 class="serviceTitle">Web Design</h3>
                <p>Globally initiate extensive "outside the box" thinking rather than cross-media solutions. Quickly supply low-risk high-yield innovation through user friendly best practices. Interactively repurpose team building initiatives and viral.
</p>
				<p>Uniquely envisioneer an expanded array of users rather than customized niche markets. Globally enable team building information rather than enterprise-wide strategic theme areas. Dynamically synthesize just in time intellectual capital via end-to-end process improvements. Synergistically target interdependent collaboration and idea-sharing before dynamic.</p>
            </div>
        </div>   
      	<!-- Seperate --
     	<div class="sep double">&nbsp;</div>
        <div class="row-fluid">
            <div class="span9 animateIconServices">
            	<h3 class="serviceTitle">Wordpress</h3>
                <p>Globally initiate extensive "outside the box" thinking rather than cross-media solutions. Quickly supply low-risk high-yield innovation through user friendly best practices. Interactively repurpose team building initiatives and viral.
</p>
				<p>Uniquely envisioneer an expanded array of users rather than customized niche markets. Globally enable team building information rather than enterprise-wide strategic theme areas. Dynamically synthesize just in time intellectual capital via end-to-end process improvements. Synergistically target interdependent collaboration and idea-sharing before dynamic.</p>
            </div>
            
            <div class="span3 alignCenter">
                <div class="singleService">
                    <div class="sepCenter">
                        <div class="outerCircle rotate3">
                            <p class="icon190"><span class="icon-sitemap"></span></p>
                        </div>
                    </div>
                </div>    
            </div>
        </div>   
      	<!-- Seperate --
     	<div class="sep double">&nbsp;</div>
        <div class="row-fluid">
            <div class="span3 alignCenter">
                <div class="singleService">
                    <div class="sepCenter">
                        <div class="outerCircle rotate1">
                            <p class="icon190"><span class="icon-map-marker"></span></p>
                        </div>
                    </div>
                </div>    
            </div>
            
            <div class="span9 animateIconServices">
            	<h3 class="serviceTitle">Mobile Apps</h3>
                <p>Globally initiate extensive "outside the box" thinking rather than cross-media solutions. Quickly supply low-risk high-yield innovation through user friendly best practices. Interactively repurpose team building initiatives and viral.
</p>
				<p>Uniquely envisioneer an expanded array of users rather than customized niche markets. Globally enable team building information rather than enterprise-wide strategic theme areas. Dynamically synthesize just in time intellectual capital via end-to-end process improvements. Synergistically target interdependent collaboration and idea-sharing before dynamic.</p>
            </div>
        </div>   
      	<!-- Seperate --
     	<div class="sep double">&nbsp;</div>
        <div class="row-fluid">            
            <div class="span9 animateIconServices">
            	<h3 class="serviceTitle">Graphics Design</h3>
                <p>Globally initiate extensive "outside the box" thinking rather than cross-media solutions. Quickly supply low-risk high-yield innovation through user friendly best practices. Interactively repurpose team building initiatives and viral.
</p>
				<p>Uniquely envisioneer an expanded array of users rather than customized niche markets. Globally enable team building information rather than enterprise-wide strategic theme areas. Dynamically synthesize just in time intellectual capital via end-to-end process improvements. Synergistically target interdependent collaboration and idea-sharing before dynamic.</p>
            </div>
            
            <div class="span3 alignCenter">
                <div class="singleService">
                    <div class="sepCenter">
                        <div class="outerCircle rotate3">
                            <p class="icon190"><span class="icon-print"></span></p>
                        </div>
                    </div>
                </div>    
            </div>
        </div>   
      	<!-- Seperate -
     	<div class="sep double">&nbsp;</div>
        
    </section>-->   
    
    <!-- Clients / Partners -->
</div><!-- End of mainContent -->

<!-- Footer -->
<footer id="pageFooterCon">  
    <!-- Copyright -->
   <div class="copyright center row-fluid"> 
        <div class="span6">&copy; 2012 <a href="http://www.eloglatihan/">E-Log Latihan Bahagian Sumber Manusia</a>, All Rights Reservered.</div>
<!--        <div class="span6"><p class="pull-right"><a href="#"> Terms Of Services</a>  /  <a href="documentation.html">Documentation</a></p></div>
-->   </div>
</footer>
<script src="../../../ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/libs/jquery-1.8.2.min.js"><\/script>')</script>
<script src="js/bootstrap.min.js"></script>
<script src="js/plugins.js"></script>
<script src="js/script.js"></script>
<script type="text/javascript" src="../../../twitter.com/javascripts/blogger.js">  
</script>
<script type="text/javascript" src="https://api.twitter.com/1/statuses/user_timeline.json?screen_name=falcon_studio&amp;callback=twitterCallback2&amp;count=2">  </script>
<!-- end scripts-->
<script>
  $(function() {
    $( "#tarikh_mula" ).datepicker({
      defaultDate: "+1w",
      changeMonth: true,
      numberOfMonths: 3,
      onClose: function( selectedDate ) {
        $( "#tarikh_tamat" ).datepicker( "option", "minDate", selectedDate );
      }
    });
    $( "#tarikh_tamat" ).datepicker({
      defaultDate: "+1w",
      changeMonth: true,
      numberOfMonths: 3,
      onClose: function( selectedDate ) {
        $( "#tarikh_mula" ).datepicker( "option", "maxDate", selectedDate );
      }
    });
	
		$("#tarikh_mula").blur(function(){
			//alert('po');
			calculateDay();
			//alert('po');
		});
		$("#tarikh_tamat").blur(function(){
			calculateDay();
		});
		$("#bil_hari").click(function(){
			//alert('po');
			calculateDay();
		});
		function calculateDay(){
			var date1 = $("#tarikh_mula").val().split("/");
			var date2 = $("#tarikh_tamat").val().split("/");
			
			//bulan hari tahun
			var tarikh1 = new Date(date1[2].split(" ")[0], date1[0], date1[1]);
			var tarikh2 = new Date(date2[2].split(" ")[0],date2[0], date2[1]);
			//alert(tarikh1+" "+tarikh2);
			
			var diff = new Date(tarikh2 - tarikh1);
			// get days
			var days = diff/(1000*60*60*24); //1000/60/60/24;
			//alert(days);
			$("#bil_hari").val(days);
		}
	});
  </script>
</body>
</html><?php
mysql_free_result($rekodkahadiran);

mysql_free_result($maklumatstaf);
?>
